# -*- coding: utf-8 -*-
from django.utils.translation import ugettext as _
from django.conf import settings
from django.http import HttpResponse, Http404, QueryDict 
from django.shortcuts import render_to_response, redirect
from django.views.generic.simple import direct_to_template
from this_site.models import *
from washing.models import *
from shop.models import *
from washing.forms import *
from washing.utils import *
from washing.views import json_mod
from django.core.paginator import Paginator
from django.core.context_processors import csrf
from django.template import RequestContext
from django.core.paginator import Paginator
import json
from django.db.models import Q
import datetime

@json_mod
def get_sum_product(request, template=None):
    context = RequestContext(request)
    context.update(csrf(request))
    if request.method == 'POST':
        product = json.loads(request.POST['product'])
        sum = getattr(Product.objects.get(pk=int(product['id'])), product['price']) * int(product['kol'])
        data = {
                'status': 'ok',
                'sum': sum,
                }
        return data
    raise Http404